##QoInterestDifferentDecayRate.R

##This file provides an analysis of varying the decay rate
##of 'weak reputation.'

library(foreign)
library(Zelig)
library(sandwich)
library(MASS)
library(lme4)
library(VGAM)
library(mlogit)

data <- read.dta(file="clare.dta")
head(data)
dim(data)

############################
## Table 1, Model 2 predicted probabilities (Figure 1 from the paper)
## WITH MODIFIED DECAY RATE OF 0.6
############################

DECAY_RATE <- 0.6


#unique(dataNew[, c("weakmr_decline9")])

table1Model2Vars <- c("cwinit", "dyad", "rivalry_count1", "weakmr_decline9", "nriv_weakdec9mr", "weakmr2_decline9", "relcap", "jdem", "pol_rel", "pceyrs", "pceyrs2",  "pceyrs3")


dataNew <- data[, table1Model2Vars]
newDecay <- DECAY_RATE
seqOfRows <- seq(1, nrow(dataNew), 1)
exponentSeq <- seq(1, 10, 1)
for (oneRow in seqOfRows) {
	for (exponentIndex in exponentSeq) {
    if (round(dataNew[oneRow, c("weakmr_decline9")], 4) == round(0.9^exponentIndex, 4)) {
  	    dataNew[oneRow, c("weakmr_decline9")] <- newDecay^exponentIndex
  	    dataNew[oneRow, c("nriv_weakdec9mr")] <- (newDecay^exponentIndex)*dataNew[oneRow, c("rivalry_count1")]
  	  }
    if (round(dataNew[oneRow, c("weakmr2_decline9")], 4) == round(0.9^exponentIndex, 4)) {
  	    dataNew[oneRow, c("weakmr2_decline9")] <- newDecay^exponentIndex
  	  }
  	}
}

#unique(dataNew[, c("weakmr_decline9")])

#head(dataNew)
#nrow(dataNew)
#dataNew <- (dataNew[-c(1529, 2591, 3291, 9479, 2285),])

dataNewNoNA <- na.omit(dataNew)

#nrow(dataNewNoNA)
#library(Zelig)
#install.packages("sandwich")
#library(sandwich)
table1Model2 <- zelig(cwinit ~ rivalry_count1 + weakmr_decline9 + nriv_weakdec9mr + weakmr2_decline9 + relcap + jdem + pol_rel + pceyrs + pceyrs2 + pceyrs3, model = "probit", data = dataNewNoNA)
coef(table1Model2)

#library(sandwich)
#install.packages("sandwich")
#install.packages("lmtest")
#library(lmtest)

mat <- estfun(table1Model2)
mat <- na.omit(mat)
dim(mat)
N <- nrow(mat)
u <- apply(mat, 2, function(x) tapply(x, dataNewNoNA$dyad, sum))
u <- na.omit(u)
numberOfClusters <- length(unique(dataNewNoNA$dyad))
df <- (numberOfClusters / (numberOfClusters - 1))*((nrow(mat) - 1)/ (nrow(mat) - table1Model2$rank))
vcovCL <- df*sandwich(table1Model2, meat=crossprod(u)/N)
ses <- coeftest(table1Model2, vcovCL)
ses
sesModel2 <- ses


#library(MASS)
#beta.draws <- mvrnorm(10000, mu = as.matrix(table1Model2$coefficients)[,1], Sigma = summary(table1Model2)$cov.unscaled)

beta.draws <- mvrnorm(10000, mu = as.matrix(table1Model2$coefficients)[,1], Sigma = vcovCL)

highrisk3 <- rep(0, 11)
#highrisk3[2:11] <- highrisk
highrisk3[1] <- 1
#values the original authors used in Stata:
highrisk3[5] <- DECAY_RATE  
highrisk3[6] <- .5
highrisk3[7] <- .36
highrisk3[8] <- 1  #scalar h_PolRel=1
highrisk3[9] <- 16
highrisk3[10] <- 684
highrisk3[11] <- 42488 #scalar h_PceYrs3=42488 






highrisk3 <- as.matrix(highrisk3)
#dim(t(beta.draws))
#test
#p.ests2 <- pnorm(t(highrisk3)%*%t(beta.draws))
#

NUMBERrivals <- seq(0, 6, 2)
yrsWeak <- 1:10
pEsts0 <- matrix(data = NA, ncol = length(yrsWeak), nrow=10000)
pEsts2 <- matrix(data = NA, ncol = length(yrsWeak), nrow=10000)
pEsts4 <- matrix(data = NA, ncol = length(yrsWeak), nrow=10000)
pEsts6 <- matrix(data = NA, ncol = length(yrsWeak), nrow=10000)

for(NUMBERrivalsIndex in 1:length(NUMBERrivals)){
  for(j in 1:length(yrsWeak)){
    highriskweak <- highrisk3
    highriskweak[2] <- NUMBERrivals[NUMBERrivalsIndex]
    highriskweak[3] <- DECAY_RATE^j
    highriskweak[4] <- NUMBERrivals[NUMBERrivalsIndex] * DECAY_RATE^j
    #highriskweak[3] <- yrsWeak[j]
    #highriskweak[4] <- NUMBERrivals * yrsWeak[j]
    if (NUMBERrivals[NUMBERrivalsIndex]==0) {
    	  pEsts0[,j] <- pnorm(t(highriskweak)%*%t(beta.draws))
    	} 
    if (NUMBERrivals[NUMBERrivalsIndex]==2) {
    	  pEsts2[,j] <- pnorm(t(highriskweak)%*%t(beta.draws))
    	}
    if (NUMBERrivals[NUMBERrivalsIndex]==4) {
    	  pEsts4[,j] <- pnorm(t(highriskweak)%*%t(beta.draws))
    	}
    if (NUMBERrivals[NUMBERrivalsIndex]==6) {
    	  pEsts6[,j] <- pnorm(t(highriskweak)%*%t(beta.draws))
    	}       	
  }
}

#pdf(file="Figure1replication06DECAY.pdf")
plot(yrsWeak-0.05, apply(pEsts0,2,mean), ylim = c(0,0.25), xlim = c(0.8, 10.5), col="red", main="Predicted Probability of Initiation (with Decay Rate of 0.6)", ylab="Probability of Initiation", xlab="Years Since Challenger Backed Down")
segments(x0 = yrsWeak-0.1, x1 = yrsWeak-0.1,
y0 = apply(pEsts0, 2, quantile, .025),
y1 = apply(pEsts0, 2, quantile, .975), col="red")

points(x = yrsWeak, y = apply(pEsts2,2,mean), col="blue")
segments(x0 = yrsWeak, x1 = yrsWeak,
y0 = apply(pEsts2, 2, quantile, .025),
y1 = apply(pEsts2, 2, quantile, .975), col="blue")

points(x = yrsWeak+0.1, y = apply(pEsts4,2,mean), col="green")
segments(x0 = yrsWeak+0.1, x1 = yrsWeak+0.1,
y0 = apply(pEsts4, 2, quantile, .025),
y1 = apply(pEsts4, 2, quantile, .975), col="green")

points(x = yrsWeak+0.2, y = apply(pEsts6,2,mean))
segments(x0 = yrsWeak+0.2, x1 = yrsWeak+0.2,
y0 = apply(pEsts6, 2, quantile, .025),
y1 = apply(pEsts6, 2, quantile, .975))

legend("topright", c("0 Other Rivals","2 Other Rivals", "4 Other Rivals", "6 Other Rivals"), bty="n",
col=c("red", "blue", "green", "black"), lwd=c(1, 1, 1, 1), lty=c(1, 1, 1, 1))
#dev.off()

############################
## Table 1, Model 2 first differences between 'strong and 0 rivals' and 'weak (after one year) and 6 rivals' (WITH MODIFIED DECAY RATE = DECAY_RATE)
##See print-out of the coefficients for each iteration at the end of this section.
############################

data <- read.dta(file="clare.dta")
head(data)
dim(data)


flipDecayRate <- function() {
table1Model2Vars <- c("cwinit", "dyad", "rivalry_count1", "weakmr_decline9", "nriv_weakdec9mr", "weakmr2_decline9", "relcap", "jdem", "pol_rel", "pceyrs", "pceyrs2",  "pceyrs3")

dataNew <- data[, table1Model2Vars]
newDecay <- DECAY_RATE
seqOfRows <- seq(1, nrow(dataNew), 1)
exponentSeq <- seq(1, 10, 1)
for (oneRow in seqOfRows) {
	for (exponentIndex in exponentSeq) {
    if (round(dataNew[oneRow, c("weakmr_decline9")], 4) == round(0.9^exponentIndex, 4)) {
  	    dataNew[oneRow, c("weakmr_decline9")] <- newDecay^exponentIndex
  	    dataNew[oneRow, c("nriv_weakdec9mr")] <- (newDecay^exponentIndex)*dataNew[oneRow, c("rivalry_count1")]
  	  }
    if (round(dataNew[oneRow, c("weakmr2_decline9")], 4) == round(0.9^exponentIndex, 4)) {
  	    dataNew[oneRow, c("weakmr2_decline9")] <- newDecay^exponentIndex
  	  }
  	}
}

dataNewNoNA <- na.omit(dataNew)

#nrow(dataNewNoNA)
#library(Zelig)
#install.packages("sandwich")
#library(sandwich)
table1Model2 <- zelig(cwinit ~ rivalry_count1 + weakmr_decline9 + nriv_weakdec9mr + weakmr2_decline9 + relcap + jdem + pol_rel + pceyrs + pceyrs2 + pceyrs3, model = "probit", data = dataNewNoNA)
coef(table1Model2)

#library(sandwich)
#install.packages("sandwich")
#install.packages("lmtest")
#library(lmtest)

mat <- estfun(table1Model2)
mat <- na.omit(mat)
#dim(mat)
N <- nrow(mat)
u <- apply(mat, 2, function(x) tapply(x, dataNewNoNA$dyad, sum))
u <- na.omit(u)
numberOfClusters <- length(unique(dataNewNoNA$dyad))
df <- (numberOfClusters / (numberOfClusters - 1))*((nrow(mat) - 1)/ (nrow(mat) - table1Model2$rank))
vcovCL <- df*sandwich(table1Model2, meat=crossprod(u)/N)
ses <- coeftest(table1Model2, vcovCL)
print("The decay rate for this iteration is: ")
print(DECAY_RATE)
print(ses)
sesModel2 <- ses

beta.draws <- mvrnorm(10000, mu = as.matrix(table1Model2$coefficients)[,1], Sigma = vcovCL)

highrisk3 <- rep(0, 11)
highrisk3[1] <- 1
#values the original authors used in Stata:
highrisk3[5] <- DECAY_RATE  
highrisk3[6] <- .5
highrisk3[7] <- .36
highrisk3[8] <- 1  #scalar h_PolRel=1
highrisk3[9] <- 16
highrisk3[10] <- 684
highrisk3[11] <- 42488 #scalar h_PceYrs3=42488 

} #end of flipDecayRate()


calcFirstDiff <- function(){


highrisk3 <- as.matrix(highrisk3)
#dim(t(beta.draws))
#test
#p.ests2 <- pnorm(t(highrisk3)%*%t(beta.draws))
#

#NUMBERrivals <- c(2, 4, 6)
NUMBERrivals <- c(6)
yrsWeak <- 1
#pEstsFD02 <- matrix(data = NA, ncol = length(yrsWeak), nrow=10000)
#pEstsFD04 <- matrix(data = NA, ncol = length(yrsWeak), nrow=10000)
pEstsFD06 <- matrix(data = NA, ncol = length(yrsWeak), nrow=10000)

for(NUMBERrivalsIndex in 1:length(NUMBERrivals)){
  for(j in 1:length(yrsWeak)){
    #for 0 rivals:
    highriskweak <- highrisk3
    highriskweak[2] <- 0
    #highriskweak[3] <- DECAY_RATE^j
    #strong reputation: 
    highriskweak[3] <- 0
    highriskweak[4] <- 0 * DECAY_RATE^j

    highriskweak2 <- highrisk3
    highriskweak2[2] <- NUMBERrivals[NUMBERrivalsIndex]
    highriskweak2[3] <- DECAY_RATE^j
    highriskweak2[4] <- NUMBERrivals[NUMBERrivalsIndex] * DECAY_RATE^j

#    if (NUMBERrivals[NUMBERrivalsIndex]==2) {
#    	  pEstsFD02[,j] <- pnorm(t(highriskweak2)%*%t(beta.draws)) - pnorm(t(highriskweak)%*%t(beta.draws))
#    	}
#    if (NUMBERrivals[NUMBERrivalsIndex]==4) {
#    	  pEstsFD04[,j] <- pnorm(t(highriskweak2)%*%t(beta.draws)) - pnorm(t(highriskweak)%*%t(beta.draws))
#    	}
    if (NUMBERrivals[NUMBERrivalsIndex]==6) {
    	  pEstsFD06[,j] <- pnorm(t(highriskweak2)%*%t(beta.draws)) - pnorm(t(highriskweak)%*%t(beta.draws))
    	}       	
  }
}
return(pEstsFD06)
} #end of calcFirstDiff()









decayRateList <- seq(0.1, 0.9, 0.1)

#decayRateList <- c(0.9, 0.6)

pEstsFD06allRates <- matrix(data = NA, ncol = length(decayRateList), nrow=10000)

for(oneDecayRateIndex in 1:length(decayRateList)){
	DECAY_RATE <- decayRateList[oneDecayRateIndex]
	flipDecayRate()
  pEstsFD06allRates[, oneDecayRateIndex] <- calcFirstDiff()

}

#pdf(file="FirstDiffAllDecayRates.pdf")
plot(decayRateList, apply(pEstsFD06allRates,2,mean), ylim = c(-0.1,0.2), xlim = c(0, 1), ylab="First Difference in Probability of Initiation", xlab="Decay Rate (0.1 to 0.9)", main="1st Diff. in P(Initiation) between Control and Max Treatment")
segments(x0 = decayRateList, x1 = decayRateList,
y0 = apply(pEstsFD06allRates, 2, quantile, .025),
y1 = apply(pEstsFD06allRates, 2, quantile, .975))
abline(h = 0, col="orange", lwd=2)
#dev.off()


###########################OUTPUT FROM THE ABOVE FUNCTION CALLS
#[1] "The decay rate for this iteration is: "
#[1] 0.1
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.5090e+00  1.3992e-01 -10.7849 < 2.2e-16 ***
#rivalry_count1   -4.3130e-03  1.7217e-02  -0.2505 0.8021929    
#weakmr_decline9   1.3173e-01  2.7595e+00   0.0477 0.9619243    
#nriv_weakdec9mr   1.5056e-01  6.5300e-01   0.2306 0.8176574    
#weakmr2_decline9  1.9136e+00  1.0524e+00   1.8184 0.0690103 .  
#relcap            1.0357e-01  1.1059e-01   0.9366 0.3489836    
#jdem              2.3478e-01  1.0854e-01   2.1632 0.0305267 *  
#pol_rel           3.7846e-01  9.2172e-02   4.1060 4.025e-05 ***
#pceyrs           -5.6212e-02  7.2861e-03  -7.7150 1.210e-14 ***
#pceyrs2           9.2820e-04  2.5791e-04   3.5990 0.0003195 ***
#pceyrs3          -4.4664e-06  2.0643e-06  -2.1636 0.0304928 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#How to cite this model in Zelig:
#Kosuke Imai, Gary King, and Oliva Lau. 2007. "probit: Probit Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
#[1] "The decay rate for this iteration is: "
#[1] 0.2
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.5093e+00  1.3968e-01 -10.8049 < 2.2e-16 ***
#rivalry_count1   -4.8982e-03  1.7316e-02  -0.2829 0.7772797    
#weakmr_decline9   7.5833e-02  1.3493e+00   0.0562 0.9551824    
#nriv_weakdec9mr   8.4710e-02  3.1864e-01   0.2658 0.7903581    
#weakmr2_decline9  1.0205e+00  5.2955e-01   1.9270 0.0539737 .  
#relcap            1.0448e-01  1.1041e-01   0.9464 0.3439697    
#jdem              2.3448e-01  1.0857e-01   2.1596 0.0308015 *  
#pol_rel           3.7818e-01  9.2094e-02   4.1065 4.018e-05 ***
#pceyrs           -5.6150e-02  7.2840e-03  -7.7086 1.272e-14 ***
#pceyrs2           9.2680e-04  2.5789e-04   3.5938 0.0003259 ***
#pceyrs3          -4.4586e-06  2.0640e-06  -2.1601 0.0307621 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#How to cite this model in Zelig:
#Kosuke Imai, Gary King, and Oliva Lau. 2007. "probit: Probit Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
#[1] "The decay rate for this iteration is: "
#[1] 0.3
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.5094e+00  1.3941e-01 -10.8271 < 2.2e-16 ***
#rivalry_count1   -5.5969e-03  1.7437e-02  -0.3210 0.7482295    
#weakmr_decline9   3.5639e-02  8.7413e-01   0.0408 0.9674787    
#nriv_weakdec9mr   6.6632e-02  2.0563e-01   0.3240 0.7459078    
#weakmr2_decline9  7.2179e-01  3.5401e-01   2.0389 0.0414583 *  
#relcap            1.0549e-01  1.1021e-01   0.9572 0.3384599    
#jdem              2.3409e-01  1.0861e-01   2.1553 0.0311355 *  
#pol_rel           3.7785e-01  9.2004e-02   4.1069 4.009e-05 ***
#pceyrs           -5.6085e-02  7.2827e-03  -7.7011 1.349e-14 ***
#pceyrs2           9.2535e-04  2.5790e-04   3.5880 0.0003333 ***
#pceyrs3          -4.4506e-06  2.0640e-06  -2.1563 0.0310627 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#How to cite this model in Zelig:
#Kosuke Imai, Gary King, and Oliva Lau. 2007. "probit: Probit Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
#[1] "The decay rate for this iteration is: "
#[1] 0.4
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.5093e+00  1.3909e-01 -10.8514 < 2.2e-16 ***
#rivalry_count1   -6.4616e-03  1.7584e-02  -0.3675 0.7132701    
#weakmr_decline9  -8.9308e-03  6.3356e-01  -0.0141 0.9887532    
#nriv_weakdec9mr   6.2163e-02  1.4804e-01   0.4199 0.6745486    
#weakmr2_decline9  5.7077e-01  2.6531e-01   2.1513 0.0314503 *  
#relcap            1.0660e-01  1.0998e-01   0.9692 0.3324329    
#jdem              2.3359e-01  1.0863e-01   2.1503 0.0315333 *  
#pol_rel           3.7749e-01  9.1893e-02   4.1079 3.992e-05 ***
#pceyrs           -5.6021e-02  7.2833e-03  -7.6916 1.453e-14 ***
#pceyrs2           9.2393e-04  2.5801e-04   3.5810 0.0003423 ***
#pceyrs3          -4.4428e-06  2.0648e-06  -2.1517 0.0314201 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#How to cite this model in Zelig:
#Kosuke Imai, Gary King, and Oliva Lau. 2007. "probit: Probit Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
#[1] "The decay rate for this iteration is: "
#[1] 0.5
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.5088e+00  1.3871e-01 -10.8778 < 2.2e-16 ***
#rivalry_count1   -7.5724e-03  1.7760e-02  -0.4264 0.6698420    
#weakmr_decline9  -6.1896e-02  4.8719e-01  -0.1270 0.8989038    
#nriv_weakdec9mr   6.4525e-02  1.1267e-01   0.5727 0.5668526    
#weakmr2_decline9  4.7748e-01  2.1116e-01   2.2612 0.0237461 *  
#relcap            1.0779e-01  1.0973e-01   0.9823 0.3259312    
#jdem              2.3294e-01  1.0862e-01   2.1446 0.0319870 *  
#pol_rel           3.7712e-01  9.1748e-02   4.1104 3.950e-05 ***
#pceyrs           -5.5961e-02  7.2876e-03  -7.6790 1.603e-14 ***
#pceyrs2           9.2268e-04  2.5831e-04   3.5720 0.0003543 ***
#pceyrs3          -4.4361e-06  2.0672e-06  -2.1460 0.0318729 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#How to cite this model in Zelig:
#Kosuke Imai, Gary King, and Oliva Lau. 2007. "probit: Probit Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
#[1] "The decay rate for this iteration is: "
#[1] 0.6
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.5076e+00  1.3824e-01 -10.9059 < 2.2e-16 ***
#rivalry_count1   -9.0369e-03  1.7966e-02  -0.5030 0.6149669    
#weakmr_decline9  -1.2252e-01  3.8729e-01  -0.3164 0.7517278    
#nriv_weakdec9mr   7.1024e-02  8.8362e-02   0.8038 0.4215223    
#weakmr2_decline9  4.1069e-01  1.7379e-01   2.3632 0.0181200 *  
#relcap            1.0902e-01  1.0945e-01   0.9961 0.3192212    
#jdem              2.3216e-01  1.0855e-01   2.1387 0.0324581 *  
#pol_rel           3.7683e-01  9.1554e-02   4.1159 3.857e-05 ***
#pceyrs           -5.5916e-02  7.2978e-03  -7.6621 1.829e-14 ***
#pceyrs2           9.2181e-04  2.5892e-04   3.5602 0.0003706 ***
#pceyrs3          -4.4320e-06  2.0723e-06  -2.1387 0.0324629 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#How to cite this model in Zelig:
#Kosuke Imai, Gary King, and Oliva Lau. 2007. "probit: Probit Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
#[1] "The decay rate for this iteration is: "
#[1] 0.7
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.5055e+00  1.3767e-01 -10.9351 < 2.2e-16 ***
#rivalry_count1   -1.0954e-02  1.8190e-02  -0.6022 0.5470530    
#weakmr_decline9  -1.8508e-01  3.1149e-01  -0.5942 0.5523964    
#nriv_weakdec9mr   7.9198e-02  7.0092e-02   1.1299 0.2585140    
#weakmr2_decline9  3.5451e-01  1.4502e-01   2.4446 0.0145028 *  
#relcap            1.1008e-01  1.0915e-01   1.0085 0.3131956    
#jdem              2.3131e-01  1.0839e-01   2.1340 0.0328402 *  
#pol_rel           3.7679e-01  9.1300e-02   4.1270 3.676e-05 ***
#pceyrs           -5.5904e-02  7.3163e-03  -7.6409 2.156e-14 ***
#pceyrs2           9.2172e-04  2.5997e-04   3.5455 0.0003919 ***
#pceyrs3          -4.4325e-06  2.0812e-06  -2.1297 0.0331924 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#How to cite this model in Zelig:
#Kosuke Imai, Gary King, and Oliva Lau. 2007. "probit: Probit Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
#[1] "The decay rate for this iteration is: "
#[1] 0.8
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.5022e+00  1.3702e-01 -10.9632 < 2.2e-16 ***
#rivalry_count1   -1.3247e-02  1.8395e-02  -0.7201 0.4714452    
#weakmr_decline9  -2.3585e-01  2.4587e-01  -0.9592 0.3374401    
#nriv_weakdec9mr   8.4966e-02  5.4996e-02   1.5449 0.1223618    
#weakmr2_decline9  2.9660e-01  1.1973e-01   2.4772 0.0132403 *  
#relcap            1.1048e-01  1.0889e-01   1.0147 0.3102709    
#jdem              2.3065e-01  1.0812e-01   2.1333 0.0328986 *  
#pol_rel           3.7739e-01  9.1007e-02   4.1468 3.371e-05 ***
#pceyrs           -5.5951e-02  7.3432e-03  -7.6194 2.549e-14 ***
#pceyrs2           9.2300e-04  2.6141e-04   3.5309 0.0004142 ***
#pceyrs3          -4.4407e-06  2.0934e-06  -2.1213 0.0338970 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#How to cite this model in Zelig:
#Kosuke Imai, Gary King, and Oliva Lau. 2007. "probit: Probit Regression for Dichotomous Dependent Variables" in Kosuke Imai, Gary King, and Olivia Lau, "Zelig: Everyone's Statistical Software," http://gking.harvard.edu/zelig
#[1] "The decay rate for this iteration is: "
#[1] 0.9
#
#z test of coefficients:
#
#                    Estimate  Std. Error  z value  Pr(>|z|)    
#(Intercept)      -1.4985e+00  1.3646e-01 -10.9812 < 2.2e-16 ***
#rivalry_count1   -1.5138e-02  1.8479e-02  -0.8192 0.4126879    
#weakmr_decline9  -2.4951e-01  1.8188e-01  -1.3719 0.1701080    
#nriv_weakdec9mr   8.1158e-02  4.1445e-02   1.9582 0.0502034 .  
#weakmr2_decline9  2.2507e-01  9.3252e-02   2.4136 0.0157955 *  
#relcap            1.0916e-01  1.0878e-01   1.0035 0.3156107    
#jdem              2.3075e-01  1.0776e-01   2.1413 0.0322528 *  
#pol_rel           3.7911e-01  9.0796e-02   4.1755 2.974e-05 ***
#pceyrs           -5.6092e-02  7.3704e-03  -7.6104 2.733e-14 ***
#pceyrs2           9.2632e-04  2.6269e-04   3.5263 0.0004214 ***
#pceyrs3          -4.4597e-06  2.1036e-06  -2.1200 0.0340038 *  
#---
#Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
#
#


